local zhuiji = fk.CreateSkill {

  name = "joysp__zhuiji",

  tags = { Skill.Compulsory, },

}



zhuiji:addEffect(fk.CardUsing, {
  name = "joysp__zhuiji",
  anim_type = "offensive",
  events = {fk.CardUsing},
  frequency = Skill.Compulsory,
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(zhuiji.name) and
      data.card.trueName == "slash"  and
      table.find(player.room:getOtherPlayers(player), function(p) return p.hp >= player.hp end)
  end,
  on_use = function(self, event, target, player, data)
    local targets = table.filter(player.room:getOtherPlayers(player), function(p) return p.hp >= player.hp end)
    if #targets > 0 then
      data.disresponsiveList = data.disresponsiveList or {}
      for _, p in ipairs(targets) do
        table.insertIfNeed(data.disresponsiveList, p.id)
      end
    end
  end,
})

zhuiji:addEffect("distance", {
  name = "#joysp__zhuiji_distance",
  frequency = Skill.Compulsory,
  fixed_func = function(self, from, to)
    if from:hasSkill(zhuiji) and from.hp >= to.hp then
      return 1
    end
  end,
})

return zhuiji